import 'package:flutter/material.dart';

class BaseButton extends StatelessWidget {

  final VoidCallback? onTap;
  final bool enabled;
  final Widget child;
  final Color buttonColor;
  final Color unabledButtonColor;
  final bool centerButton;
  final double? width;
  final double? height;
  final double radius;
  final bool withShadow;
  final bool withBorder;
  final bool miniButton;

  const BaseButton(
      {Key? key,
        required this.radius,
        required this.child,
        this.width,
        this.height,
        this.enabled = true,
        this.onTap,
        this.withShadow = true,
        this.centerButton = true,
        this.unabledButtonColor = Colors.black26,
        this.buttonColor = Colors.blue,
        this.withBorder = false,
        this.miniButton = false
      }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Widget button = InkWell(
      onTap: enabled ? onTap : null,
      child: Container(
        width: width,
        height: height,
        alignment: !miniButton ? Alignment.center : null,
        decoration: BoxDecoration(
          boxShadow: withShadow ? [
            const BoxShadow(
              color: Colors.black45,
              offset: Offset(1, 1),
              blurRadius: 4,
            ),
          ] : null,
          borderRadius: BorderRadius.circular(radius),
          color: enabled ? buttonColor : unabledButtonColor,
          border: withBorder
              ? Border.all(color: Colors.black26, width: 1) : null,
        ),
        child: child,
      ),
    );
    return centerButton ? Center(child: button) : button;
  }
}